import { defineConfig } from 'vite'
import { viteExternalsPlugin } from 'vite-plugin-externals'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    viteExternalsPlugin({
      'mapbox-gl': 'mapboxgl'
    })
  ],
  define: {
    'process.browser': `''`,
    'process.env': process.env,
    'process.version': `''`
  },
  // externals: {
  //   'mapbox-gl': 'mapbox-gl-enhance'
  // },
  resolve: {
    alias: {
      'process': 'process/browser',
      'stream': 'stream-browserify',
      'os': 'os-browserify/browser',
      '@': path.resolve(__dirname, 'src')
    }
  }
})
